package a02Collectiondemo2;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

public class Test1 {
    public static void main(String[] args) {

        Collection<String> coll = new ArrayList<>();
        coll.add("张三");
        coll.add("李四");
        coll.add("王五");

        Iterator<String> it = coll.iterator();

        while (it.hasNext()) {
            String str = it.next();
            if("张三".equals(str)){
                it.remove();
            }

        }
        System.out.println(coll);
    }
}
